-- This script was generated by the Schema Diff utility in pgAdmin 4
-- For the circular dependencies, the order in which Schema Diff writes the objects is not very sophisticated
-- and may require manual changes to the script to ensure changes are applied in the correct order.
-- Please report an issue for any failure with the reproduction steps.

ALTER TABLE IF EXISTS public.user_api_keys DROP CONSTRAINT IF EXISTS user_api_keys_pkey;

ALTER TABLE IF EXISTS public.user_api_keys
    ADD CONSTRAINT user_api_keys_pkey PRIMARY KEY (api_key_hash, user_id);
ALTER TABLE IF EXISTS public.user_api_keys
    ADD CONSTRAINT user_api_keys_user_id_fkey FOREIGN KEY (user_id)
    REFERENCES auth.users (id) MATCH SIMPLE
    ON UPDATE NO ACTION
    ON DELETE NO ACTION;
